package com.itheima03.day14;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @author 刘全
 * @date 2021/8/6
 */
public class TestDemo4 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable mc = new MyCallable();
        FutureTask<String> ft1 = new FutureTask<>(mc);
        Thread tr1 = new Thread(ft1);
        FutureTask<String> ft2 = new FutureTask<>(mc);
        Thread tr2 = new Thread(ft2);
        tr1.start();
        tr2.start();
        String s1 = ft1.get();
        System.out.println(s1);
        String s2 = ft2.get();
        System.out.println(s2);
    }
}
